package com.iamteer.utils;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class WebUtils {
	/**
	 * 跳转的通用方法
	 * @throws IOException 
	 * @throws ServletException 
	 */
	public static void goTo(HttpServletRequest request, HttpServletResponse response, Object uri) throws ServletException, IOException {
		if (uri instanceof RequestDispatcher) {
			((RequestDispatcher)uri).forward(request, response);
		} else {
			response.sendRedirect(request.getContextPath() + uri);
		}
	}
}
